<template>
	<view class="container">
		<u-form :model="form" ref="uForm" class="Uform">
			<u-form-item>
				<u-input v-model="form.verifyMsg" type="textarea" placeholder="请输入发布信息" />
			</u-form-item>
		</u-form>
		<u-button type="primary" class="fabuBtn" @click="fabu">发布</u-button>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				form: {
					verifyMsg: ''
				}
			}
		},
		onLoad(options) {
			this.id = options.id
		},
		methods: {
			fabu() {
				this.$u.api.productSubmit({
					id: this.id,
					verifyMsg: this.form.verifyMsg
				}).then(res => {
					if (res.code == 0) {
						var page = getCurrentPages();
						var currPage = page[page.length-2];
						currPage.$vm.refreshPage();
						this.$refs.uToast.show({
							title: '发布成功',
							type: 'success',
							back: true
						});
					} else {
						this.$refs.uToast.show({
							title: '发布失败'+res.msg,
							type: 'success'
						})
					}
				})
			}
		}
	}
</script>

<style scoped>
	.container {
		padding: 30rpx;
	}

	.Uform {
		border: 1px solid rgb(212 227 247);
		margin-bottom: 60rpx;
		border-radius: 10rpx;
		padding: 0 20rpx;
	}

	.fabuBtn {
		width: 606rpx;
		background-color: #1F6ECF;
		border-radius: 43rpx;
		height: 86rpx;
		line-height: 86rpx;
		font-size: 34rpx;
		box-shadow: 0px 12px 16px 0px rgba(28, 100, 224, 0.32);
	}
</style>
